#!/bin/bash
set -x
echo "Starting Label Studio ML Backend service..."

# Activate conda environment
conda activate labelstudio

# Check and create ML Backend
if [ ! -d "my_ml_backend" ]; then
    echo "Creating ML Backend..."
    label-studio-ml init my_ml_backend
fi

# Install dependencies
cd my_ml_backend
pip install -r requirements.txt
cd ..

# Start ML Backend service
echo "Starting Label Studio ML Backend service..."
cd my_ml_backend
python api.py

read -p "Press [Enter] key to continue..."